﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.NaviMenus;
using PMS.Data.Entities.Security;

namespace PMS.Data.EntityMap.NaviMenus
{
    /// <summary>
    /// Represents a AclReocrd mapping configuration
    /// </summary>
    public partial class AclReordMap : PMSEntityTypeConfiguration<AclRecord>
    {
        #region Methods

        /// <summary>
        /// Configures the entity
        /// </summary>
        /// <param name="builder">The builder to be used to configure the entity</param>
        public override void Configure(EntityTypeBuilder<AclRecord> builder)
        {
            builder.ToTable("bus_aclrecord");
            builder.HasKey(Acl => Acl.Id);

            builder.Property(Acl => Acl.EntityName).HasMaxLength(200).IsRequired();
            builder.Property(Acl => Acl.EntityId).IsRequired();
            builder.Property(Acl => Acl.CustomerRoleId).IsRequired();

            builder.Ignore(Acl => Acl.IsActive);
            builder.Ignore(Acl => Acl.CreatedOnTimeUtc);
            builder.Ignore(Acl => Acl.UpdatedOnTimeUtc);

            base.Configure(builder);
        }

        #endregion
    }
}
